$OpenBSD: patch-src_ChatSelector_cpp,v 1.1 2011/12/27 11:51:37 dcoppa Exp $

Fix crash in chat window on disconnected client
(upstream git commit ea45371bda1aa96fe63967c15e360b11d9d84bbd)

--- src/ChatSelector.cpp.orig	Mon Jun 13 10:50:25 2011
+++ src/ChatSelector.cpp	Tue Dec 27 10:47:03 2011
@@ -352,11 +352,13 @@ bool CChatSelector::GetCurrentClient(CClientRef& clien
 	
 	// Get the client that the session is open to
 	if (ci) {
-		clientref.Link(theApp->clientlist->FindClientByIP(IP_FROM_GUI_ID(ci->m_client_id), PORT_FROM_GUI_ID(ci->m_client_id)) CLIENT_DEBUGSTRING("CChatSelector::GetCurrentClient"));
-		return true;
-	} else {
-		return false;
+		CUpDownClient * client = theApp->clientlist->FindClientByIP(IP_FROM_GUI_ID(ci->m_client_id), PORT_FROM_GUI_ID(ci->m_client_id));
+		if (client) {
+			clientref.Link(client CLIENT_DEBUGSTRING("CChatSelector::GetCurrentClient"));
+			return true;
+		}
 	}
+	return false;
 }
 #endif
 
